Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plotting error when a track only has a single state #721

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

sdhiscocks
Copy link
Member

This was caused by squeeze removing extra dimension when only a single state was present. Using concatenate along correct dimension avoids this.

This was caused by squeeze removing extra dimension when only a single
state was present. Using concatenate along correct dimension avoids
this.
@sdhiscocks sdhiscocks added the bug label Sep 22, 2022
@sdhiscocks sdhiscocks requested a review from a team as a code owner September 22, 2022 07:49
@sdhiscocks sdhiscocks requested review from nperree-dstl and hpritchett-dstl and removed request for a team September 22, 2022 07:49
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Base: 94.66% // Head: 94.66% // No change to project coverage 👍

Coverage data is based on head (c25549d) compared to base (f88c394).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #721   +/-   ##
=======================================
  Coverage   94.66%   94.66%           
=======================================
  Files         171      171           
  Lines        8773     8773           
  Branches     1707     1707           
=======================================
  Hits         8305     8305           
  Misses        342      342           
  Partials      126      126           
Flag Coverage Δ
integration 70.03% <100.00%> (+0.01%) ⬆️
unittests 90.75% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stonesoup/plotter.py 91.64% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@gawebb-dstl gawebb-dstl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I tested it with this snippet of code

from stonesoup.plotter import Plotter
from stonesoup.types.track import Track
from stonesoup.types.state import State
import matplotlib.pyplot as plt

t1 = Track([State([1,2]),
            State([2,4])])
t2 = Track([State([1,4])])

plotter = Plotter()
plotter.plot_tracks(t1, mapping=[0,1])
try:
    plotter.plot_tracks(t2, mapping=[0, 1])
    print("Pass")
except IndexError:
    print("Fail")

plt.show()

@sdhiscocks sdhiscocks merged commit 14fdd8b into main Sep 22, 2022
@sdhiscocks sdhiscocks deleted the plotting_bug branch September 22, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants